#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 110;

int n,a[N];
int maxn,minn=N,cnt;
void dfs(int res,int cur,int len,int p){
    if(!res){
        printf("%d",len);exit(0);
    }
    if(cur==len){dfs(res-1,0,len,maxn);return;}
    for(int i=p;i>=minn;i--){
        if(a[i]&&i+cur<=len){
            a[i]--;
            dfs(res,i+cur,len,i);
            a[i]++;
            if(!cur||cur+i==len)break;
        }

        
    }
    return;
}
int main()
{
    scanf("%d",&n);
    int x,sum=0;
    while(n--){
        scanf("%d",&x);
        if(x<=50){
            maxn=maxn>x?maxn:x;
            minn=minn<x?minn:x;
            a[x]++;sum+=x;
        }
    }
    x=sum>>1;
    for(int i=maxn;i<=x;i++)
        if(sum%i==0)dfs(sum/i,0,i,maxn);
    cout<<sum;
    return 0;
}